/**
 * <p>Copyright: Copyright (c) 2014</p>
 * <p>Company: UMP Technology Co. Ltd</p>
 * <p>2014年7月21日</p>
 * @author Zhang Wensheng
 */
package com.xianl.common;

import java.util.HashMap;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * desc: 
 * @author Zhang Wensheng
 * date:2014年7月21日
 */
public class PlatLogger {
	
	private Logger logger = null;
	
	private static Map<String, PlatLogger> logMap = new HashMap<String, PlatLogger>();
	
	private PlatLogger(Class<?> clazz){
		this.logger = LoggerFactory.getLogger(clazz);
	}
	
	public static PlatLogger getLogger(Class<?> clazz){
		String key = clazz.toString();
		if(!logMap.containsKey(key)){
			PlatLogger plogger = new PlatLogger(clazz);
			logMap.put(key, plogger);
		}
		return logMap.get(key);
	}
	
	public void debug(String msg){
		logger.debug("["+RpidManager.getRpid()+"] "+msg);
	}
	
	public void debug(String format, Object... args){
		logger.debug("["+RpidManager.getRpid()+"] "+format, args);
	}
	
	public void debug(String msg, Throwable t){
		logger.debug("["+RpidManager.getRpid()+"] "+msg, t);
	}
	
	public void info(String msg){
		logger.info("["+RpidManager.getRpid()+"] "+msg);
	}
	
	public void info(String format, Object... args){
		logger.info("["+RpidManager.getRpid()+"] "+format, args);
	}
	
	public void info(String msg, Throwable t){
		logger.info("["+RpidManager.getRpid()+"] "+msg, t);
	}
	
	
	public void error(String msg){
		logger.error("["+RpidManager.getRpid()+"] "+msg);
	}
	
	public void error(String format, Object... args){
		logger.error("["+RpidManager.getRpid()+"] "+format, args);
	}
	
	public void error(String msg, Throwable t){
		logger.error("["+RpidManager.getRpid()+"] "+msg, t);
	}
	
	
	

}
